package exception;

public abstract class BaseException extends RuntimeException {

	public final static int NOT_LOGIN_ERROR_CODE = 1001;
	public final static int USER_PASSWORD_ERROR_CODE = 1002;

	public final static int DB_ACCESS_ERROR_CODE = 2000;
	public final static int DB_SAVE_ERROR_CODE = 2001;
	public final static int DB_UPDATE_ERROR_CODE = 2002;
	public final static int DB_DELETE_ERROR_CODE = 2003;

	public final static int WORKFLOW_ERROR_CODE = 3000;
	public final static int WORKFLOW_START_ERROR_CODE = 3001;
	public final static int WORKFLOW_PROCESS_ERROR_CODE = 3002;

	public final static int PERMISSION_ERROR_CODE = 4000;

	public final static int OTHER_ERROR_CODE = 9000;

	private static final long serialVersionUID = -5794093845350414L;
	protected Integer errorCode = -1;
	protected Throwable innerException;

	public BaseException(Integer errCode,Throwable innerException) {
		super();
		this.errorCode = errCode;
		this.innerException = innerException;
		
	}

	public BaseException(int errCode, String message) {
		super(message);
		this.errorCode = errCode;
	}
	
	public BaseException(int errCode, String message,Throwable innerException) {
		super(message);
		this.errorCode = errCode;
		this.innerException = innerException;
	}

	public BaseException() {
		super();
		this.errorCode = OTHER_ERROR_CODE;
	}

	public Integer getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(Integer errorCode) {
		this.errorCode = errorCode;
	}

	public BaseException(String message) {
		super(message);
	}

	public BaseException(Throwable cause) {
		super(cause);
	}

	public BaseException(String message, Throwable cause) {
		super(message, cause);
	}

}
